<template>
    <header class="simple-header van-hairline--bottom">
        <van-icon v-if="!isback" name="arrow-left" @click="goBack"/>
        <i v-else></i>
        <div class="simple-header-name">{{name}}</div>
        <i class="nbicon nbmore"></i>
    </header>
    <div class="block"></div>
</template>

<script>
import {ref} from 'vue'
import {useRouter} from 'vue-router'

export default {
    props: {
        name: {
            type: String,
            default: ''
        },
        back: {
            type: String,
            default: ''
        },
        noback: {
            type: Boolean,
            default: false
        }
    },
    emits: ['callback'],
    setup(props,ctx) {
        const isback = ref(props.noback);
        const router = useRouter();
        const goBack = () =>{
            !props.back ? router.go(-1) : router.push({path:props.back})
        }
        ctx.emit('callback')
        return{
            goBack,
            isback
        }
    },
    
}
</script>

<style lang="scss" scoped>
@import '@/common/style/mixin';
.simple-header{
    position: fixed;
    align-items: center;
    top: 0;
    left: 0;
    z-index: 10000;
    @include fj();
    @include wh(100%, 44px);
    line-height: 44px;
    padding: 0 10px;
    @include boxSizing();
    color: #252525;
    background: #fff;
    .simple-header-name {
      font-size: 14px;
    }
}
.block {
    height: 44px;
}
</style>
